#pragma once

struct WaitingUserContext
{
	WaitingUserContext(DWORD user_id, DWORD ip, DWORD msg_id, DWORD overlap_index)
	{
		this->user_id = user_id;
		this->ip = ip;
		this->msg_id = msg_id;
		this->overlap_index = overlap_index;
	}

	DWORD user_id;
	DWORD ip;
	DWORD msg_id;
	DWORD overlap_index;
};

typedef std::map<DWORD, WaitingUserContext> WaitingUsersMap;

class WaitingUserManager
{
public:
	WaitingUserManager(void);
	~WaitingUserManager(void);

public:
	void RegisterUser(DWORD user_id, DWORD ip, DWORD msg_id, DWORD overlap_index);
	void UnregisterUser(DWORD user_id);
	const WaitingUserContext* FindUserContext(DWORD user_id) const;
	void UpdateUserContext(DWORD user_id, DWORD ip, DWORD msg_id, DWORD overlap_index);

private:
	WaitingUserContext* GetUserContext(DWORD user_id);

private:
	WaitingUsersMap waiting_users_;
};

